//
// Created by Dell on 2021/11/27.
//

#include <iostream>
#include <math.h>
#include <algorithm>
#include <string.h>
using namespace std;
struct Num{
    int number[1000];
    int len;
    Num(){
        len = 0;
        memset(number,0,sizeof(number));
    }
    Num(string x){
        len = x.length();
        memset(number,0,sizeof(number));
        reverse(x.begin(),x.end());
        for(int i = 0;i<len;++i){
            number[i] = x[i]-'0';
        }
    }
};

string Add(string x,string y){
    Num c,a(x),b(y);

    c.len = max(a.len,b.len);
    for(int i = 0;i<max(a.len,b.len);++i){
        c.number[i] += (a.number[i] + b.number[i]);

        c.number[i+1] += c.number[i]/10;
        c.number[i] %= 10;
    }

    while(c.number[c.len]){
        c.number[c.len+1] += c.number[c.len]/10;
        c.number[c.len] %= 10;
        ++c.len;
    }
    string s ="";
    for(int i = c.len-1;i>=0;--i){
        s += (char)(c.number[i] + '0');
    }
    return s == ""?"0":s;
}

string Sub(string x,string y) {
    Num c, a(x), b(y);
    // 默认大减小
    c.len = max(a.len, b.len);
    for (int i = 0; i < max(a.len, b.len); ++i) {
        if (a.number[i] - b.number[i] >= 0) {
            c.number[i] += a.number[i] - b.number[i];
        } else {
            c.number[i] += a.number[i] - b.number[i] + 10;
            c.number[i + 1] -= 1;
        }
    }
    while(!c.number[c.len]){
        --c.len;
    }
    string s ="";
    for(int i = c.len;i>=0;--i){
        s += (char)(c.number[i] + '0');
    }
    return s == ""?"0":s;
}

string Mul(string x,int b) {
    Num c, a(x);
    // 默认大减小
    c.len = a.len;
    for (int i = 0; i < a.len; ++i) {
        c.number[i] += (a.number[i] * b);
        c.number[i+1] += c.number[i]/10;
        c.number[i] %= 10;
    }
    while(c.number[c.len]){
        c.number[c.len+1] += c.number[c.len]/10;
        c.number[c.len] %= 10;
        ++c.len;
    }
    string s ="";
    for(int i = c.len-1;i>=0;--i){
        s += (char)(c.number[i] + '0');
    }
    return s == ""?"0":s;
}

string Div(string x,int b,int &r) {
    Num c, a(x);
    // 默认大减小
    c.len = a.len;
    for (int i = a.len - 1; i >= 0; --i) {
        r = r*10 + a.number[i];
        if(r<b) c.number[i] = 0;
        else{
            c.number[i] = r/b;
            r = r %b;
        }
    }
    while(c.len-1>=1&&c.number[c.len-1] == 0){
        --c.len;
    }
    string s ="";
    for(int i = c.len-1;i>=0;--i){
        s += (char)(c.number[i] + '0');
    }
    return s == ""?"0":s;
}
int main(){
//    string a,b;
//    int r = 0;
//    cin>>a>>b;
//    cout<<Add(a,b)<<'\n';
//    cout<<Sub(a,b)<<'\n';
    string a;int b;
    int r = 0;
    cin>>a>>b;
    cout<<Mul(a,b)<<'\n';
    cout<<Div(a,b,r)<<" "<<r<<'\n';
}


